package cn.edu.scau.cmi.zhangjunming.composite.consisentPersion;

import java.util.Set;

public class ConsistentComposite extends ConsistentComponent {

	private String name;
	
	public ConsistentComposite(){
		type = 0;
	}
	
	public String doSomething() {
		return "这里是一致型组件";
	}

	@Override
	public ConsistentComponent getParent() {
		return parent;
	}

	@Override
	public ConsistentComponent addChild(ConsistentComponent child) {
		System.out.println("添加新子节点");
		this.children.add(child);
	    return this;
	}

	@Override
	public Set<ConsistentComponent> getChild() {
		// TODO 自动生成的方法存根
		return children;
	}
	
	public void setName(String s) {
		name = s;
	}
	
	public String getName() {
		return name;
	}

	@Override
	public void setParent(ConsistentComponent parent) {
		this.parent = parent;
		
	}

	@Override
	public ConsistentComponent deliete(ConsistentComponent child) {
		children.remove(child);
		return this;
	}

	public int getType() {
		return type;
	}

	@Override
	public void setType() {
		type = 0;
	}

}
